<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link href="../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../css/H-ui.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <title></title>
</head>
<body>
<article class="page-container tradeOrderDetail">
    <form id="custFrom" method="post" class="form form-horizontal">
        <div class='row cl marginTB'>
            <div class="formControls col-xs-3 col-sm-3">
                <input type="hidden" id="id" name="id" data-cusId="">
            </div>
        </div>

        <div class='row cl marginTB'>
            <div class="row cl col-xs-6 col-sm-6">
                <label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>客户姓名：</label>
                <div class="formControls col-xs-8 col-sm-7">
                    <input type="text" class="input-text bgeee" value="" placeholder="" id="custName" name="custName" readonly="readonly">
                </div>
            </div>

            <div class="row cl col-xs-6 col-sm-6">
                <label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>提现前佣金：</label>
                <div class="formControls col-xs-8 col-sm-7">
                    <input type="text" class="input-text bgeee" value="" placeholder="" id="balancePre" name="balancePre" readonly="readonly">
                </div>
            </div>
        </div>
        <div class='row cl marginTB'>
            <div class="row cl col-xs-6 col-sm-6">
                <label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>提现后佣金：</label>
                <div class="formControls col-xs-8 col-sm-7">
                    <input type="text" class="input-text bgeee" value="" placeholder="" id="balanceAfter" name="balanceAfter" readonly="readonly">
                </div>
            </div>

            <div class="row cl col-xs-6 col-sm-6">
                <label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>申请提现金额：</label>
                <div class="formControls col-xs-8 col-sm-7">
                    <input type="text" class="input-text bgeee" value="" placeholder="" id="amount" name="amount" readonly="readonly">
                </div>
            </div>
        </div>
        <div class='row cl marginTB'>
            <div class="row cl col-xs-6 col-sm-6">
                <label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>流水类型：</label>
                <div class="formControls col-xs-8 col-sm-7">
                    <select name="paymentChannel" id="paymentChannel" disabled="disabled" style="width: 183px;">
                        <option value="">流水类型</option>
                        <option value="10">生成</option>
                        <option value="20">提现</option>
                    </select>
                </div>
            </div>
            <div class="row cl col-xs-6 col-sm-6">
                <label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>流水状态：</label>
                <div class="formControls col-xs-8 col-sm-7">
                    <select name="status" id="status" disabled="disabled" style="width: 183px;" >
                        <option value="-1">无效</option>
                        <option value="0">待确认</option>
                        <option value="1">有效</option>
                    </select>
                </div>
            </div>
        </div>
        <div class='row cl marginTB'>

            <div class="row cl col-xs-6 col-sm-6">
                <label class="form-label col-xs-4 col-sm-5"><span class="c-red">*</span>创建时间：</label>
                <div class="formControls col-xs-8 col-sm-7">
                    <input type="text" class="input-text bgeee" value="" placeholder="" id="createTime" name="createTime" readonly="readonly">
                </div>
            </div>
        </div>
        <div class='row cl marginTB clearfix' style="padding: 30px 180px;">
            <div class="fl">
                <span class="btn btn-success radius" onclick="submit(1)" readonly="readonly">确认</span>
            </div>
            <div class="fr">
                <span class="btn btn-success radius" onclick="submit(-1)" readonly="readonly">驳回</span>
            </div>
        </div>
    </form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="/js/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/js/H-ui.js"></script>
<script type="text/javascript" src="/js/H-ui.min.js"></script>
<script type="text/javascript" src="/js/postJson.js"></script>
<script type="text/javascript" src="/js/root.js"></script>
<!--/_footer 作为公共模版分离出去-->
<script>
    var carriageId = parent.$("#carriageId").attr("dataId");
    var custName = parent.$("#custName").attr("dataName");
    var pageNum = parent.$("#custName").attr("data-pageNum");
    function getData(){
        var jsonObj = {
            "id":Number(carriageId)
        }
        var jsonData = JSON.stringify(jsonObj)
        var url = "/custCarriageController/getCustCarriageWithdrawDetailById"
        $.ajax({
            url:url,
            type:"POST",
            data:jsonData,
            dataType:"json",
            async:false,
            contentType: "application/json",
            success:function(msg){
                // console.log(JSON.stringify(msg));
                if(msg.success == true){
                    $("#custName").val(custName)
                    $("#balancePre").val(msg.data.balancePre)
                    $("#balanceAfter").val(msg.data.balanceAfter)
                    $("#amount").val(msg.data.amount)
                    $("#businessType").find("option[value='" + msg.data.businessType + "']").attr("selected", true);
                    $("#status").find("option[value='" + msg.data.status + "']").attr("selected", true);
                    $("#createTime").val(TimeHours(msg.data.createTime))
                }
            }
        })
    }
    getData()
   function submit(status) {
        var str = status == 1 ? "是否确认提现运费？" : "是否驳回提现运费？";
        layer.confirm(str, function(index){
            var jsonObj = {
                "id":Number(carriageId),
                "status":status
            }
            var jsonData = JSON.stringify(jsonObj)
            var url = "/custCarriageController/updateCustCarriageWithdrawStatusById";
            $.ajax({
                url:url,
                type:"POST",
                data:jsonData,
                dataType:"json",
                async:false,
                contentType: "application/json",
                success:function(msg){
                    if(msg.success==true){
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.msg("审核成功！",{icon:1,time:3000})
                        window.parent.frames.getData(Number(pageNum));
                        parent.layer.close(index);
                    }else{
                        var errorMsg = msg.errorMessage
                        parent.layer.msg(errorMsg,{icon:2,time:5000})
                    }
                },
                error:function(XMLHttpRequest,textStatus,errorThrown){
                    var XmlStatus = XMLHttpRequest.status
//                         console.log(XMLHttpRequest.status)
                    if(XmlStatus==401){
                        alert(XmlError.error401)
                        parent.window.location.href = "../login.html"
                    }
                    if(XmlStatus==403){
                        alert(XmlError.error403)
                    }
                }
            });
        })
    }
</script>
</body>
</html>